﻿using BSAppDOne.WebAdmin.Custom;
using Logics.Sys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using Zo.Config;
using Zo.Http;

namespace BSAppDOne.WebAdmin.Areas.Admin.Controllers
{
    [AdminActionFilter(NoLogin= true)]
    public class LoginController : BaseController
    {
        AccountLogic _Logic = new AccountLogic();
        // GET: Admin/Login
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Check(string UserName, string Password, string LoginCode)
        {
            var token = _Logic.Checked(UserName, Password, LoginCode);
            return this.Success(new
            {
                jumpurl = AppConfig.HomePageUrl,
                token = token
            });
        }

        /// <summary>
        /// 退出登录
        /// </summary>
        /// <returns></returns>
        public ActionResult Out()
        {
            HttpCookieHelper.RemoveCookie("Authorization");
            return RedirectToAction("Index");
        }
    }
}